home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Dr. Windows 3
/
dr win3.zip
/
dr win3
/
NEW_TECH
/
SIM_IN.ZIP
/
USERCODE.C
< prev
next >
Wrap
C/C++ Source or Header
|
1993-11-05
|
3KB
|
138 lines
#include <windows.h>
#include "the_dll.h"
#include <stdio.h>
#include <float.h>
/******************************************************************************\
*
* FUNCTION: DllMain
*
* INPUTS: hDLL - handle of DLL
* dwReason - indicates why DLL called
* lpReserved - reserved
*
* RETURNS: TRUE (always, in this example.)
*
* Note that the retuRn value is used only when
* dwReason = DLL_PROCESS_ATTACH.
*
* Normally the function would return TRUE if DLL initial-
* ization succeeded, or FALSE it it failed.
*
* GLOBAL VARS: ghMod - handle of DLL (initialized when PROCESS_ATTACHes)
*
* COMMENTS: The function will display a dialog box informing user of
* each notification message & the name of the attaching/
* detaching process/thread. For more information see
* "DllMain" in the Win32 API reference.
*
\******************************************************************************/
INT UserFunc1(HWND hWndMain);
BOOL WINAPI DllMain (HANDLE hDLL, DWORD dwReason, LPVOID lpReserved)
{
switch (dwReason)
{
case DLL_PROCESS_ATTACH:
{
char buf[BUFSIZE+1];
//
// DLL is attaching to the address space of the current process.
//
ghMod = hDLL;
GetModuleFileName (NULL, (LPTSTR) buf, BUFSIZE);
/*
MessageBox ( GetFocus(),
(LPCTSTR) buf,
(LPCTSTR) "THE_DLL: Process attaching",
MB_OK | MB_SYSTEMMODAL);
*/
break;
}
case DLL_THREAD_ATTACH:
//
// A new thread is being created in the current process.
//
/*
MessageBox ( GetFocus(),
(LPCTSTR) "THE_DLL: Thread attaching",
(LPCTSTR) "",
MB_OK | MB_SYSTEMMODAL);
break;
*/
case DLL_THREAD_DETACH:
//
// A thread is exiting cleanly.
//
/*
MessageBox ( GetFocus(),
(LPCTSTR) "THE_DLL: Thread detaching",
(LPCTSTR) "",
MB_OK | MB_SYSTEMMODAL);
break;
*/
case DLL_PROCESS_DETACH:
//
// The calling process is detaching the DLL from its address space.
//
/*
MessageBox ( GetFocus(),
(LPCTSTR) "THE_DLL: Process detaching",
(LPCTSTR) "",
MB_OK | MB_SYSTEMMODAL );
*/
break;
}
return TRUE;
}
/******************************************************************************\
*
* FUNCTION: UserFunc1
*
* RETURNS: float
*
\******************************************************************************/
INT UserFunc1(HWND hWndMain){
///your code goes here
// MessageBox (hWndMain, "This is a test of the User DLL","Init",MB_ICONASTERISK | MB_OK);
// fUserDelay = 3.14;
return 555;
}
/**************************************************************************************/